/* eslint-disable eol-last */
/* eslint-disable semi */
/* eslint-disable no-trailing-spaces */
/* eslint-disable no-unused-vars */
/* eslint-disable strict */
/**
 * 登录守卫
*/

module.exports = options => {
  return async function adminauth(ctx, next) {
    // console.log(ctx.session.openId)

    if (ctx.session.openId) {
      // 验证成功，流程走向下一步
      await next()
    } else {
      // 验证失败，返回 '未登录'
      ctx.body = { data: '未登录' }
    }
  }
}